<?


require_once  $_SERVER['DOCUMENT_ROOT']."/../_lib/base/common.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.template.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holidays.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.destinations.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.weather.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.lurls.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.photos.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.hotels.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.tree.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.breadcrumb.php";



	$template = new template();
	$lurls = new lurls();
	$destinations = new destinations();
	$weather = new weather();
	$photos = new photos();
	$breadcrumb = new breadcrumb();
	$tree = new tree();
	
	// get the destination values
	$params['tree_id'] = $_GET['tree_id'];
	$params['cache']['seconds'] = '2400';
	$destination_values = $tree->get_branch($params,2);
	$destination_values = $destination_values[0];
	unset($params);
	
	// If not found then send to 404 error
	if(!$destination_values){
		header("HTTP/1.0 404 Not Found"); 
		include($_SERVER['DOCUMENT_ROOT']."/404.php");
		exit;
	}

	// get parent destinations
	$params['type_id'] = '1';
	$params['tree_id'] = $destination_values['parent_id'];
	$params['cache']['seconds'] = '2400';
	$parent_destination = $tree->get_branch($params);
	$parent_destination = $parent_destination[0];
	unset($params);
	
	// get sibling resorts
	$params['type_id'] = '2';
	$params['parent_id'] = $destination_values['parent_id'];
	//$params['cache']['seconds'] = '2400';
	$sibling_resorts = $tree->get_children($params);
	unset($params);

	if(!empty($sibling_resorts)){
		foreach($sibling_resorts as $value){
			$sibling_resorts_string .= $value['name'].", ";
		}
	}

	
	// get photos
	$destination_photos = $photos->get_photos($destination_values['tree_id']);
	if($destination_photos){
		$lead_hotel_thumb_url = UPLOAD_HTTP_PERM.$destination_photos[0]['photo_url_thumb'];
	}

	// Get Yahoo weather reports
	$cache['seconds'] = '2400';
	$weather_day_reports = $weather->fetch_reports($parent_destination['yahoo_weather_location_id'], $cache);
	unset($cache);
	
	// Template
	$template->title = $destination_values['name']." ".$parent_destination['name']." Holidays, About ".$destination_values['name'];
	$template->meta_description = "Cheap holidays to ".$destination_values['name']." from Ireland. Information about ".$destination_values['name'].", things to do, hotels and weather in ".$destination_values['name'].".";
	$template->section_highlight = "guides";
	$template->left_col = true;
	$template->breadcrumbs_html = $breadcrumb->get_html_breadcrumb($destination_values['lineage']);	
	$template->ld_head();
	

	
	
	

?>




<h2>About <?= $destination_values['name'] ?> Holidays</h2>


<!-- Start column -->

<div class="col_400 margin_right_10">


<? 


if($destination_photos){

?>

<div class="div_photo_left">
<div class='thumb_cover_div'>
<a href="#"><img src="<?= $lead_hotel_thumb_url ?>" alt="<?= $destination_values['name'] ?>" class="thumb_image_100" />
<img src="/images/thumb_cover_100_74.gif" class="thumb_cover" alt="<?= $destination_values['name'] ?>" /></a>	
</div>
</div>

<?

} 
?>

<?= $destination_values['description'] ?>



<? include SITE_ROOT_PATH."/_lib/html/destination_details_tabs.php"; ?>



</div>
<!-- End column -->














<!-- Start column -->
<div class='col_200'>






<? if($destination['map_image_url']){ ?>

<!-- Start map -->

<p title="<?= $destination['name'] ?> map"><img src="<?= UPLOAD_HTTP_PERM.$destination['map_image_url'] ?>" alt="<?= $destination['name'] ?> map" /></p>

<!-- End map -->

<? } ?>













<? if($sibling_resorts){ ?>


<!-- Start sibling resorts -->


<h4><?= $parent_destination['name'] ?> resorts</h4>

<ul class="list_qlinks">
<?
	foreach($sibling_resorts as $resort){
		$lurl = $lurls->get_branch_lurl($resort['tree_id']);
		echo "<li><a href='".$lurl."'>".$resort['name']."</a></li>";
	}
?>
</ul>

<!-- End sibling resorts -->


<? } ?>






<? 
	// Get child hotels

	$hotels = new hotels();
	unset($params);
	$params['parent_id'] = $destination_values['tree_id'];
	$params['order'] = "stars";
	$params['cache']['seconds'] = '2400';
	$child_hotels = $hotels->search_hotels($params);
	unset($params);

	if($child_hotels){ 

?>


<!-- Start child hotels -->
<h4>Hotels in <?= $destination_values['name'] ?></h4>

<ul class="list_qlinks">
<?
	
	foreach($child_hotels as $child_hotel_values){
		if(($child_hotel_values['hotel_rating']) AND ($child_hotel_values['hotel_rating']!==$last_rating)){
		$last_rating = $child_hotel_values['hotel_rating'];
		echo "<li title=\"Cheap ".$child_hotel_values['hotel_rating']." star hotels in ".$destination_values['name']."\"><strong>".$child_hotel_values['hotel_rating']." star hotels</strong></li>";
		}
		$lurl = $lurls->get_branch_lurl($child_hotel_values['tree_id']);
		echo "<li><a href='".$lurl."'>".$child_hotel_values['name']."</a></li>";
	}
?>
</ul>

<!-- End child hotels -->

<? } ?>










<!-- end column -->
</div>




<?

$template->ld_foot();


	
	
?>